package com.chiaching.chaoxingsecondkill.domain;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.LinkedHashSet;

/**
 * @author jiajing.he
 * @date 2021/3/17 22:43
 */
@Data
public class UserInfo {

    private String name;
    private String email;
    private String phone;

    private String password;
    private String seatNum;
    private String cookies;

    /**
     * 是否开启抢座
     */
    private Boolean isStart=Boolean.TRUE;

    private LinkedHashSet<String> times=new LinkedHashSet<>();

    private LinkedHashSet<String> allMsg=new LinkedHashSet<>();

    public UserInfo() {
    }

    public UserInfo(String name, String phone, String password, String seatNum, String cookies) {
        this.name = name;
        this.phone = phone;
        this.password = password;
        this.seatNum = seatNum;
        this.cookies = cookies;
    }

    public void reverseKillStatus(){
        setIsStart(!this.isStart);
    }

    public boolean isSkip(String time){
        return times.contains(time);
    }

    public void addTime(String time){
        times.add(time);
    }

    public void addMsg(String msg){
        allMsg.add(msg);
    }
}
